<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title></title>
    <style></style>
  </head>
  <body>
    <div id="test"></div>
    <!-- 引入react核心库 -->
    <script src="../js/react.development.js"></script>
    <!-- 引入react Dom库 用于支持 react操作dom-->
    <script src="../js/react-dom.development.js"></script>
    <!-- 引入babel 用于将 jsx 转为 js -->
    <script src="../js/babel.min.js"></script>

    <!-- 使用babel 转译jsx -->
    <script type="text/babel">
      class A extends React.Component {
        render() {
          return (
            <div>
              <div>我是A组件</div>
              <B
                render={(name) => {
                  return <C name={name} />;
                }}
              />
            </div>
          );
        }
      }
      class B extends React.Component {
        state = { name: "tome" };
        render() {
          return (
            <div>
              <div>我是B组件</div>
              {this.props.render(name)}
            </div>
          );
        }
      }
      class C extends React.Component {
        render() {
          return (
            <div>
              <div>我是C组件{this.props.name}</div>
            </div>
          );
        }
      }
      ReactDOM.render(<A />, document.getElementById("test"));
    </script>
  </body>
</html>
